<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
   <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>购物车</title>
<script type="text/javascript" src="js/jquery-1.8.3.min.js"></script>
<script src="js/jquery1.42.min.js" type="text/javascript"></script>
<script src="js/jquery.SuperSlide.2.1.1.js" type="text/javascript"></script>
<script src="js/publicNav.js" type="text/javascript"></script>
<script src="js/index.js" type="text/javascript"></script>
<script type="text/javascript" src="js/showCartBox.js"></script>
 <link rel="stylesheet"  href="css/adminAdd.css"  type="text/css" />
<link href="css/base.css" rel="stylesheet" type="text/css" />
</head>

<body>
<!--顶部top-->
<div class="topMenu">
  <div class="indexCont">
    <ul class="fl tW tL" style="width:190px;">
      <li class="b1"><i></i><a href="javascript:;">收藏我买网</a></li>
      <li class="b2"><i></i><a href="javascript:;">移动客户端</a></li>
    </ul>
    <div class="fr tW">
      <ul class="fl">
		        <li class="login" style="white-space:nowrap;height:32px;line-height:32px;">
        	<c:if test="${user.usertype==0 || user.usertype==null }">
        	 		<b>您好，欢迎您来到顺丰优选</b> 
        	</c:if>
        	<c:if test="${user.usertype==1 }">
        		<a href="${pageContext.request.contextPath}/admin_insert.jsp" target="_blank">亲爱的，请注入商品</a>
        	</c:if>
     
        <c:if test="${user != null }">
       		  <a href="${pageContext.request.contextPath}/loginout.do" target="_blank">${user.usercode}&nbsp;退出</a>
        </c:if>
        <c:if test="${user == null }">
         		<a href="${pageContext.request.contextPath}/login_f.jsp" target="_blank">登录</a>
        </c:if>
		         <a  href="${pageContext.request.contextPath}/register.jsp" target="_blank">注册</a>
		         <a href="${pageContext.request.contextPath}/orderslist.do">我的订单 </a> 
		         </li>
      </ul>
      <ul id="tMenu" class="fr tW tmCont">
        <li class="webnav"> <strong class="top_icon"><a href="javascript:;"> 我的素品 </a></strong>
          <div class="top_hidebox wdsp">
            <div class=""> <a href="userOrder.html">我的订单</a> </div>
            <div> <a href="javascript:;">我的积分</a> </div>
            <div> <a href="javascript:;">我的收藏</a> </div>
            <div> <a href="javascript:;">账户余额</a> </div>
            <div> <a href="javascript:;">我的选项卡</a> </div>
            <div> <a href="javascript:;">我的优惠券</a> </div>
          </div>
        </li>
        <li class="webnav"> <strong class="top_icon"><a href="javascript:;"> 服务中心 </a></strong>
          <div class="top_hidebox">
            <div class=""> <a href="javascript:;">购物指南</a> </div>
            <div> <a href="javascript:;">配送服务</a> </div>
            <div> <a href="javascript:;">支付方式</a> </div>
            <div> <a href="javascript:;">售后服务</a> </div>
            <div> <a href="javascript:;">客服邮箱</a> </div>
            <div> <a href="javascript:;">投诉与建议</a> </div>
          </div>
        </li>
        <li class="webnavdh" style="background:none"> <strong class="top_icon"><a href="javascript:;"> 网站导航 </a></strong>
          <div class="top_hidebox">
            <ul class="dh-list">
              <li class="dh_title"> <a  href="javascript:;"style="padding-left:0;">生鲜食品</a> <a href="javascript:;">酒水饮料</a> <a  href="javascript:;">粮油副食</a> <a href="javascript:;">休闲食品</a> <a  href="javascript:;">营养养生</a> </li>
              <li class="line"></li>
              <li class="dh_wenzi">
                <h4>饼干点心</h4>
                <a class="dh_oneTle"href="javascript:;">服饰</a><s>|</s> <a href="javascript:;">图书</a><s>|</s> <a href="javascript:;">办公直通车</a><s>|</s> <a href="javascript:;">视频购物</a><s>|</s> <a href="javascript:;">品牌街</a><s>|</s> <a href="javascript:;">礼品卡</a><s>|</s> <a href="javascript:;">电子书</a><s>|</s> <a href="javascript:;">运动馆</a> </li>
              <li class="line"></li>
              <li class="dh_wenzi">
                <h4>冲调茶饮</h4>
                <a   class="dh_oneTle"href="javascript:;">商旅</a><s>|</s> <a   href="javascript:;">保险</a><s>|</s> <a   href="javascript:;">彩票</a><s>|</s> <a   href="javascript:;">水电煤</a><s>|</s> <a   href="javascript:;">游戏</a><s>|</s> <a   href="javascript:;">PPTV下载</a> </li>
              <li class="line"></li>
              <li class="dh_wenzi">
                <h4>美食用品</h4>
                <a   class="dh_oneTle"href="javascript:;">应用商店</a><s>|</s> <a   href="javascript:;">苏宁云</a><s>|</s> <a   href="javascript:;">社区</a><s>|</s> <a   href="javascript:;">客户端</a><s>|</s> <a   href="javascript:;">对公销售</a><s>|</s> <a   href="javascript:;">会员联盟</a><s>|</s> <a   href="javascript:;">商家入驻</a> </li>
            </ul>
          </div>
        </li>
      </ul>
    </div>
  </div>
</div>
<!--顶部top]]-->
<div class="header">
  <div class="logo"> <img src="images/logogs.gif" width="260" height="75"/>
    <div class="logo-text"><font>融创</font>旗下朔源产品在线商城</div>
  </div>
  <div class="processor" >
    <ol class="processorBox oh">
      <li class="current">
        <div class="step_inner fl"> <span class="icon_step">1</span>
          <h4>我的购物车</h4>
        </div>
      </li>
      <li>
        <div class="step_inner"> <span class="icon_step">2</span>
          <h4>确认订单信息</h4>
        </div>
      </li>
      <li>
        <div class="step_inner fr"> <span class="icon_step">3</span>
          <h4>付款，完成购买</h4>
        </div>
      </li>
    </ol>
    <div class="step_line"></div>
  </div>
</div>
</div>
<div class="cartShowline"></div>
  <form action="">
<div class="jdCont">
  <div class="carTip">
    <div class="lt"><i></i><em>我的购物车</em></div>
    <div class="cart_login">亲爱的<a href="javascript:;">${user.usercode}</a>，购物车中商品将被永久保存</div>
  </div>
  

  <script type="text/javascript">
	$(document).ready(function () {

	//jquery特效制作复选框全选反选取消(无插件)
	// 全选        
	$(".allselect").click(function () {
		$(".gwc_tb2 input[name=newslist]").each(function () {
			$(this).attr("checked", true);
			// $(this).next().css({ "background-color": "#3366cc", "color": "#ffffff" });
		});
		GetCount();
	});

	//反选
	$("#invert").click(function () {
		$(".gwc_tb2 input[name=newslist]").each(function () {
			if ($(this).attr("checked")) {
				$(this).attr("checked", false);
				//$(this).next().css({ "background-color": "#ffffff", "color": "#000000" });
			} else {
				$(this).attr("checked", true);
				//$(this).next().css({ "background-color": "#3366cc", "color": "#000000" });
			} 
		});
		GetCount();
	});

	//取消
	$("#cancel").click(function () {
		$(".gwc_tb2 input[name=newslist]").each(function () {
			$(this).attr("checked", false);
			// $(this).next().css({ "background-color": "#ffffff", "color": "#000000" });
		});
		GetCount();
	});

	// 所有复选(:checkbox)框点击事件
	$(".gwc_tb2 input[name=newslist]").click(function () {
		if ($(this).attr("checked")) {
			//$(this).next().css({ "background-color": "#3366cc", "color": "#ffffff" });
		} else {
			// $(this).next().css({ "background-color": "#ffffff", "color": "#000000" });
		}
	});

	// 输出
	$(".gwc_tb2 input[name=newslist]").click(function () {
		// $("#total2").html() = GetCount($(this));
		GetCount();
		//alert(conts);
	});
});
//******************
function GetCount() {
	var conts = 0;
	var aa = 0;
	$(".gwc_tb2 input[name=newslist]").each(function () {
		
		var tot = $(this).parent(".cart_cx").siblings(".cart_sum").children(".tot");
		var t = $(this).parent(".cart_cx").siblings(".cart_amount").children(".cart_mid");
		var cart_price = $(this).parent(".cart_cx").siblings(".cart_price");
		tot.html((parseInt(t.val()) * Number(cart_price.html())).toFixed(2));
		$(this).val(parseInt(t.val())* Number(cart_price.html()));
		console.log($(this).val());
		
		if ($(this).attr("checked")) {
			for (var i = 0; i < $(this).length; i++) {
				conts += parseInt($(this).val());
				aa += 1;
			}
		}
	});
	$("#shuliang").text(aa);
	$("#zong1").html((conts).toFixed(2));
	$("#jz1").css("display", "none");
	$("#jz2").css("display", "block");
}
</script>

  <div class="gwc groups_wrapper" style=" margin:auto;"> 
    
    <!---商品加减算总数--> 
    <script type="text/javascript">
	$(function () {
		$(".cart_minus1").click(function () {
			var t=$(this).next();
			t.val(parseInt(t.val()) - 1);
			var tot=$(this).parent(".cart_amount").next().children(".tot");
			var newslist=$(this).parent(".cart_amount").siblings(".cart_cx").children(".newslist");
			var cart_price=$(this).parent(".cart_amount").prev();
			tot.html((parseInt(t.val()) * Number(cart_price.html())).toFixed(2));
			newslist.val(parseInt(t.val())* Number(cart_price.html()));
			
			if(t.val()==1){
				t.val(1);
			}
			/* setTotal(); */ GetCount();
			if(t.val()==1){
				$('.dis_min').attr('disabled','disabled');
				$('.dis_min').addClass('disabled');
			}else if (t.val()>=1){
				$('.dis_min').removeAttr('disabled');
				$('.dis_min').removeClass('disabled');
			}
		})
		$(".cart_minus").click(function (event) {
			
			var t=$(this).prev();
			t.val(parseInt(t.val()) + 1)
			var tot=$(this).parent(".cart_amount").next().children(".tot");
			var newslist=$(this).parent(".cart_amount").siblings(".cart_cx").children(".newslist");
			var cart_price=$(this).parent(".cart_amount").prev();
			tot.html((parseInt(t.val()) * Number(cart_price.html())).toFixed(2));
			newslist.val(parseInt(t.val())* Number(cart_price.html()));
			/* setTotal(); */ //GetCount();
			if(t.val()==1){
				$('.dis_min').attr('disabled','disabled');
				$('.dis_min').addClass('disabled');
			}else if (t.val()>=1){
				$('.dis_min').removeAttr('disabled');
				$('.dis_min').removeClass('disabled');
			}
			var id=$(this).parent(".cart_amount").siblings(".cart_cx").children(".cartsid").val();
			console.log(id);
 		/*  	$.post("${pageContext.request.contextPath}/addcart.do",{
				goodsId: id,
				prices:tot									
			}, function(data){
			});   */
		})
			$(".newslist").click(function(){
				var ids=[];
					$(":checked").each(function(){
						if($(this).is(':checked')){
							ids.push("id="+$(this).next().val());
						}
					});
					console.log(ids);
				  	$("#jz2").attr("href","${pageContext.request.contextPath}/jeisuan.do?"+ids.join("&"));
			})
	})
	
	</script>
    <table cellpadding="0" width="100%" cellspacing="0" class="gwc_tb2 order_contents">
      <tr>
        <th class="cart_cx"style="width: 70px;"> <div class="pre_header">
            <input id="Checkbox1"type="checkbox" class="allselect inputComStyle"/>
            <label class="label_style">全选</label>
          </div>
        </th>
        <!-- <th class="tb1_th1">全选</th> -->
        <th class="cart_name">地友素品</th>
        <th class="cart_price">单价</th>
        <th class="cart_amount">数量（件）</th>
        <th class="cart_sum">小计（元）</th>
        <th class="cart_operate">操作</th>
      </tr>

      <c:forEach items="${carts}" var="carts">
      <tr>
		        <td class=" cart_cx">
		        <input type="checkbox" value="1" name="newslist" id="newslist-1"   class="newslist"/>
		        <input  type="hidden"   value="${carts.id}"  name="id"  class="cartsid"/>
		        </td>
		        <td class="cart_name"><div class="cart_things">${carts.shopname} <a class="cart_img">
		        <img src="${pageContext.request.contextPath}/download.do?filename=${carts.cartimg}" width="60" height="60"/></a>
		        
		         	<a class="cart_infro">${carts.cartinfo}</a> </div>
		         
		         </td>
		        <td class="cart_price"  id="cart_price">${carts.price}</td>
		        <td class="cart_amount">
				        <input id="min1" name=""   class="cart_minus1 dis_min disabled"  style="width:20px;height:20px ;background:white;border:1px  solid  #eee"  type="button" value="-"  disabled  />
				          <input id="text_box1" name="" type="text" value="1" class="cart_mid"/>
				          <input id="add1"  class="cart_minus" type="button"   value="+" />
		          </td>
		        <td class="cart_sum"  id="cart_sum"><label id="total1" class="tot" style="color:#ff5500;font-size:14px; font-weight:bold;">${carts.price}</label></td>
		        <td class="cart_operate"><a href="${pageContext.request.contextPath}/cartdelete.do?id=${carts.id}" class="cart_remove">删除</a></td>
      </tr>
       </c:forEach>
    </table>
   
		  <ul class="table_yc">
		   			
		  <c:choose>
		  
		  		 <c:when test="${pager.totalPage == 0}" >
			    <%-- 	<li class="${pager.currentPage==i?'active1':''}">
				    			<a href="${pageContext.request.contextPath}/joincart.do?currentPage=${i}"  style="color: black">${i}</a>
				    </li> --%>
				    <li><a  href="${pageContext.request.contextPath}/index.do "  class="a_chart">主人，你他娘的没钱还敢逛淘宝，求求你不要秀了，充钱啊，嘤嘤嘤！！</a></li>
		    	</c:when>
		    	
				  	<c:when test="${pager.totalPage<5}">
					  		<c:forEach begin="1" end="${pager.totalPage}" var="i">
				    			<li class="${pager.currentPage==i?'active1':''}">
					    			<a href="${pageContext.request.contextPath}/joincart.do?currentPage=${i}"  style="color: black">${i}</a>
					    		</li>
			    		</c:forEach>
				  	  </c:when>
				  	  
				  	 <c:when test="${pager.totalPage >= 5}">
			     		<c:forEach begin="0" end="4" var="j">
							<c:if test="${pager.currentPage == pager.totalPage-j}">
								<c:forEach begin="${pager.currentPage-4+j}" end="${pager.currentPage+j}" var="i">
									<li class="${pager.currentPage==i?'active1':''}">
					    				<a href="${pageContext.request.contextPath}/joincart.do?currentPage=${i}"  style="color: black">${i}</a>
					    			</li>
								</c:forEach>
							</c:if>		     			
			     		</c:forEach>
				     	 <c:if test="${pager.currentPage<pager.totalPage-4}">
				     		<c:forEach begin="${pager.currentPage}" end="${pager.currentPage+4}" var="i">
				     				<li class="${pager.currentPage==i?'active1':''}">
					    				<a href="${pageContext.request.contextPath}/joincart.do?currentPage=${i}"  style="color: black">${i}</a>
					    			</li>
				     		</c:forEach>
				     	</c:if>
		     	</c:when>
		   </c:choose>
		   
      </ul>
    <!---商品加减算总数--> 
    <script type="text/javascript">

	$(function(){
		$('.cart_remove').click(function(){
			$(this).parent().parent().remove();
		})
	})
	 
			
	
	</script>
    <!---总数--> 
    <script type="text/javascript">
	$(function () {
	
			
		
		
		$(".quanxun").click(function () {
			setTotal();
			//alert($(lens[0]).text());
		});
		$("#shuliang").text(0);
		function setTotal() {
			var len = $(".tot");
			var num = 0;
			$("#zong1").text(parseInt(num).toFixed(2));
			for (var i = 0; i < len.length; i++) {
				num = parseInt(num) + parseInt($(len[i]).text());
			}
			//alert(len.length);
		} 
		setTotal(); 
	})
	</script>
    <div class="option_account">
      <div class="l_btn">
        <div class="lr5" style="margin-left: 20px;">
          <input id="checkAll" class="allselect inputComStyle" type="checkbox"/>
          <label class="label_style">全选</label>
        </div>
        <div class="lr5">
          <input id="invert" type="checkbox" class="inputComStyle"/>
          <label class="label_style">反选</label>
          <!-- <input id="cancel" type="checkbox" class="inputComStyle"/><label class="label_style">取消</label> --> 
        </div>
      </div>
      <div class="r_btn"> <span class="last_select">购物车有
        <label id="shuliang" class="select_data">0</label>
        件</span>
        <div class="last_moy"><span class="fl"style="white-space:nowrap;">商品应付总额:</span><span class="m_num">￥</span>
          <label id="zong1" class="m_num">0.00</label>
        </div>
        <div class="fl"> <span id="jz1" class="fl disbtn">结算</span>
        <a href="${pageContext.request.contextPath}/jeisuan.do" style="display:none;"class="jz2 openlogin fl" id="jz2">结算</a>
        </div>
        
      </div>
    </div>
  </div>
</div>
</form>
<!--footer搜索-->
<div class="indexContFooter"> 
  <!--footer搜索end--> 
  <!--底层foot-start-->
  <div class="footer">
    <div class="foot-cont">
      <dl class="fore1">
        <dt><b></b><strong>购物指南</strong></dt>
        <dd>
          <div><a href="#">购物流程</a></div>
          <div><a href="#">会员介绍</a></div>
          <div><a href="#">团购/机票</a></div>
          <div><a href="#">常见问题</a></div>
          <div><a href="#">大家电</a></div>
          <div><a href="#">联系客服</a></div>
        </dd>
      </dl>
      <dl class="fore2">
        <dt><b></b><strong>配送方式</strong></dt>
        <dd>
          <div><a href="#">上门自提</a></div>
          <div><a href="#">211限时达</a></div>
          <div><a href="#">配送服务查询</a></div>
          <div><a href="#">配送费收取标准</a></div>
          <div><a href="#">海外配送</a></div>
        </dd>
      </dl>
      <dl class="fore3">
        <dt><b></b><strong>支付方式</strong></dt>
        <dd>
          <div><a href="javascript:;">货到付款</a></div>
          <div><a href="javascript:;" >在线支付</a></div>
          <div><a href="javascript:;" >分期付款</a></div>
          <div><a href="javascript:;" >邮局汇款</a></div>
          <div><a href="javascript:;" >公司转账</a></div>
        </dd>
      </dl>
      <dl class="fore4">
        <dt><b></b><strong>售后服务</strong></dt>
        <dd>
          <div><a href="javascript:;" >售后政策</a></div>
          <div><a href="javascript:;">价格保护</a></div>
          <div><a href="javascript:;">退款说明</a></div>
          <div><a href="javascript:;">返修/退换货</a></div>
          <div><a href="javascript:;">取消订单</a></div>
        </dd>
      </dl>
    </div>
    <div class="footer_center">
      <div class="links"> <a href="javascript:;">关于我们</a>| <a href="javascript:;">联系我们</a>| <a href="javascript:;">友情链接</a>| <a href="javascript:;">免责条款</a>| <a href="javascript:;">广告服务</a>| <a href="javascript:;">食品流通许可证</a>| <a href="javascript:;">营业执照</a> </div>
    </div>
    <div class="footer_copyright">
      <p> Copyright © 2014-2019 5RICE.吾米网 版权所有 黑ICP备11002788号 保留一切权利。 客服热线：400-400-5555 </p>
      <p>京公网安备 110105001608 | 京ICP证111033号 | 食品流通许可证 SP1101051110165515（1-1） | 营业执照</p>
    </div>
    <div class="footer_cx">
      <p> <a href="javascript:;"><img src="images/footerbomC.png" width="112"height="40"></a> <a href="javascript:;"><img src="images/footerbomX.gif" width="112"height="40"></a> </p>
    </div>
  </div>
</div>
<!--底层foot]]-->
</body>
</html>
